package com.rtx.wms.std.asn.controller;

import javax.servlet.http.HttpServletRequest;

import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.CrossOrigin;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import com.alibaba.fastjson.JSON;
import com.rtx.wms.customer.k3.down.K3ReceiptCreate;
import com.rtx.wms.std.qm.bean.RtxQMResponse;

import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;

/**
 * <p>
 *  前端控制器
 * </p>
 *
 * @author zcw
 * @since 2023-04-20
 */
@Api(tags = {"入库单"})
@RestController
@RequestMapping("/v1/wms/asn")
@CrossOrigin
public class ApiReceiptController {
	
	Logger logger = LoggerFactory.getLogger(this.getClass());

    @Autowired
    private K3ReceiptCreate asnCreateHandler;



    @ApiOperation(value = "入库单创建")
    @PostMapping("/create/std")
    public String returnOrderCreate(HttpServletRequest request){
    	RtxQMResponse res = new RtxQMResponse();
    	try {
    		asnCreateHandler.createReceipt(request);
    		res.setSuccess("成功");
    	} catch (Exception e) {
    		logger.error("入库单：{}，创建异常：",e);
    		res.setFailure(e.getMessage());
    	}
    	
    	return JSON.toJSONString(res);
    }
}
